package com.gss.common.exception.oauth;

import com.gss.entity.enums.ConstantEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;


@EqualsAndHashCode(callSuper = true)
@Data
public class AuthException extends RuntimeException{
    private static  long serialVersionUID = 1L;

    private Integer errorCode;
    private String errorMessage;

    public AuthException() {
        super();
    }

    public AuthException(Throwable cause) {
        super(cause);
    }

    public AuthException(String msg, Throwable cause) {
        super(msg, cause);
        this.errorMessage = msg;
    }

    public AuthException(Integer code, String msg) {
        super(msg);
        this.errorCode = code;
        this.errorMessage = msg;
    }

    public AuthException(Integer errorCode, String errorMessage, Throwable cause) {
        super("[" + errorCode + "]" + errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public AuthException(ConstantEnum constantEnum) {
        this(constantEnum.getCode(), constantEnum.getMsg());
    }
}
